home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts39-09
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c
- Subject: Re: int main() vs int main(void)
- Date: Thu, 08 Feb 96 18:13:57 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4fde76$flj@sam.inforamp.net>
- References: <1996Feb7.201848.18734@atlas.tntech.edu>
- NNTP-Posting-Host: ts39-09.tor.inforamp.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <1996Feb7.201848.18734@atlas.tntech.edu>,
- jad7084@tntech.edu (Jim Davis) wrote:
- >Okay, void main() is naughty, but there's something else I've been
- >wondering about, and I can't find it in the FAQ.
- >
- >Is there a difference between
- >
- > int main()
- > int main(void)
- >
- >? () is equivalent to (void), right? Does it matter? Am I worried about
- >nothing?
- >
-
- My understanding is that in C++, there is absolutely no difference. But in C,
- there is a slight difference. I think the proper example is the following...
-
- void f(void);
- void f(){};
-
- This two line program is the key. It compile in C++ and doesn't in C. You
- have to change the program to...
-
- void f(void);
- void f(void){};
-
- ..for it to compile in C. But, I'm not an expert on the subject. So, I'd
- confirm this by compiling the programs yourself. No other differences exist
- in my books.
-
- Agrivar
-